package com.xiang.publicdemo.module2;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.context.ServletContextAware;

import javax.servlet.ServletContext;

@EnableAutoConfiguration
@EnableConfigurationProperties
@SpringBootApplication
@ComponentScan({"com.xiang.publicdemo"})
@ServletComponentScan
@EnableAsync
public class Module2WebApplication implements ServletContextAware {
    public static void main(String[] args) {
        SpringApplication.run(Module2WebApplication.class, args);
    }

    @Override
    public void setServletContext(ServletContext context) {
        String ctx = context.getContextPath();
        context.setAttribute("ctx", ctx);
    }
}
